package com.jingshui.Controller;

import com.alibaba.fastjson.JSONObject;
import com.jingshui.Service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import orm.base.Ex.BaseControllerEx;

import java.util.Map;

/**
 * Created by ashin on 2017/9/29.
 */

@Controller
@Scope("prototype")
@RequestMapping("/order")
public class OrderController extends BaseControllerEx {

    @Autowired
    OrderService orderService;

    @Override
    protected void init() {
        super.init(orderService);
    }


    @RequestMapping(value = "/doReserve",method = RequestMethod.POST)
    public JSONObject doReserve(@RequestParam Map map) throws Exception{
        return orderService.reserve(map,session);
    }


    /**
     * 查詢預購列表信息
     * @param map
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/doQueryOrderInfo",method = RequestMethod.POST)
    public JSONObject doQueryOrderInfo(@RequestParam Map map) throws Exception{
        return orderService.queryOrderInfo(map,session);
    }

    /**
     * 管理员查询
     * @param map
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/doQueryAdmin",method = RequestMethod.POST)
    public JSONObject doQueryAdmin(@RequestParam Map map) throws Exception{
        return orderService.queryAdmin(map);
    }


}
